package com.zx.controller.gotos;

import com.zx.dto.request.goods.GoodsRequestDto;
import com.zx.dto.response.brand.BrandDto;
import com.zx.dto.response.goods.GoodsDetailDto;
import com.zx.dto.response.goods.GoodsDto;
import com.zx.dto.response.goods.GoodsListDtoResult;
import com.zx.dto.response.specification.SpecificationBrandDto;
import com.zx.service.brand.BrandService;
import com.zx.service.goods.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author sunkai
 * @date 2022/7/30 0030 16:41
 * @mood zhou xun
 */
@Controller
@RequestMapping("/goods")
public class GoodsController {
    @Autowired
    private GoodsService goodsService;

    @GetMapping("/recommend/goods")
    @ResponseBody
    public List<GoodsDto> queryGoods() {
        return goodsService.queryGoods();
    }
    @GetMapping("/query/list")
    @ResponseBody
    public GoodsListDtoResult queryGood(GoodsRequestDto goodsRequestDto) {
        return goodsService.queryGood(goodsRequestDto);
    }
    /*商品详情*/
    @GetMapping("/detail")
    @ResponseBody
    public GoodsDetailDto detail(@RequestParam(value = "goodsId") Integer goodsId) {
        return goodsService.queryMerchandiseDetails(goodsId);
    }
    @GetMapping("/sort")
    @ResponseBody
    public GoodsListDtoResult goodSort(GoodsRequestDto goodsRequestDto) {
        return goodsService.goodSort(goodsRequestDto);
    }
    @GetMapping("/good/shop")
    @ResponseBody
    public List<GoodsDetailDto> goodShop(List<Integer> integers){
        return goodsService.queryGoodShop(integers);
    }
}
